package com.mebs.edi.model.edi.e214;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import com.mebs.edi.model.dom.DomAttribute;
import com.mebs.edi.model.dom.DomEntity;

/**
 * 
 * N4 section of a 214 EDI file 
 * 
 * @author nit
 *
 */
@Embeddable
@DomEntity(name = "N4")
public class Edi214N4 {
	
	@Column(nullable = true, length = 30)
	@DomAttribute
	private String n401; 	// Pickup City
	
	@Column(nullable = true, length = 30)
	@DomAttribute
	private String n402; 	// Pickup State or Provence
	
	@Column(nullable = true, length = 15)
	@DomAttribute
	private String n403; 	// Pickup Postal Code
	
	@Column(nullable = true, length = 3)
	@DomAttribute
	private String n404; 	//Pickup Country Code
	
	public Edi214N4() {
		super();
	}

	public String getN401() {
		return n401;
	}

	public void setN401(String n401) {
		this.n401 = n401;
	}

	public String getN402() {
		return n402;
	}

	public void setN402(String n402) {
		this.n402 = n402;
	}

	public String getN403() {
		return n403;
	}

	public void setN403(String n403) {
		this.n403 = n403;
	}

	public String getN404() {
		return n404;
	}

	public void setN404(String n404) {
		this.n404 = n404;
	}

	@Override
	public String toString() {
		return "Edi214N4 [n401=" + n401 + ", n402=" + n402 + ", n403=" + n403 + ", n404=" + n404 + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((n401 == null) ? 0 : n401.hashCode());
		result = prime * result + ((n402 == null) ? 0 : n402.hashCode());
		result = prime * result + ((n403 == null) ? 0 : n403.hashCode());
		result = prime * result + ((n404 == null) ? 0 : n404.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Edi214N4 other = (Edi214N4) obj;
		if (n401 == null) {
			if (other.n401 != null)
				return false;
		} else if (!n401.equals(other.n401))
			return false;
		if (n402 == null) {
			if (other.n402 != null)
				return false;
		} else if (!n402.equals(other.n402))
			return false;
		if (n403 == null) {
			if (other.n403 != null)
				return false;
		} else if (!n403.equals(other.n403))
			return false;
		if (n404 == null) {
			if (other.n404 != null)
				return false;
		} else if (!n404.equals(other.n404))
			return false;
		return true;
	}
}
